package com.itheima.test;

import org.junit.Test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Id2BirthDay {
    public static void main(String[] args) throws ParseException {
        String id = "444585199911117958";
        Date date = idToBirthday(id);
    }
    public static Date idToBirthday(String id) throws ParseException {
        String substring = id.substring(6, 15);
        String year = substring.substring(0, 4);
        String month = substring.substring(4, 6);
        String day = substring.substring(7);
        String birthday = year + "-" + month + "-" + day;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date Birthday = sdf.parse(birthday);
        return Birthday;
    }
}
